// Problem: G. Turtle Magic: Royal Turtle Shell Pattern
// Contest: Codeforces - Codeforces Round 929 (Div. 3)
// URL: https://codeforces.com/contest/1933/problem/G
// Memory Limit: 256 MB
// Time Limit: 3000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
ll n, m, q;
cin >> n >> m >> q;
string s1(2, '#'), s2(2, '#');
bool failed = false;
int ans = 0;
cout << 8 << '\n';
while (q--) {
int r, c;
string shape;
cin >> r >> c >> shape;
--r, --c;
// cerr << "r=" << r << ",c=" << c << ",shape=" << shape << endl;
char ch = shape[0];
auto check = [] (int x, int y, string &dir, char ch) {
// cerr << "x=" << x << ",y=" << y << ",ch=" << ch << endl;
int target = x % 2;
int rev = ((x / 2 - y) % 2 + 2) % 2;
if (rev == 1) {
if (ch == 'c') {
ch = 's';
} else {
ch = 'c';
}
}
// cerr << "target=" << target << ",ch=" << ch << endl;
if (dir[target] == '#') {
dir[target] = ch;
} else if (dir[target] == ch) {
} else {
dir = "ff";
}
};
check(r, c, s1, ch);
check(c, r, s2, ch);
// cerr << "s1=" << s1 << ",s2=" << s2 << endl;
int ans = 0;
for (auto &h : {s1, s2}) {
if (h == "ff") {
continue;
}
int tmp = 1;
for (auto x : h) {
if (x == '#') tmp *= 2;
}
ans += tmp;
}
cout << ans << '\n';
}
}
int main() {
int tt;
cin >> tt;
while (tt--) {
solve();
}
}
1635A - Min Or Sum | 474A - Keyboard |
1343A - Candies | 1343C - Alternating Subsequence |
1325A - EhAb AnD gCd | 746A - Compote |
318A - Even Odds | 550B - Preparing Olympiad |
939B - Hamster Farm | 732A - Buy a Shovel |
1220C - Substring Game in the Lesson | 452A - Eevee |
1647B - Madoka and the Elegant Gift | 1408A - Circle Coloring |
766B - Mahmoud and a Triangle | 1618C - Paint the Array |
469A - I Wanna Be the Guy | 1294A - Collecting Coins |
1227A - Math Problem | 349A - Cinema Line |
47A - Triangular numbers | 1516B - AGAGA XOOORRR |
1515A - Phoenix and Gold | 1515B - Phoenix and Puzzle |
155A - I_love_username | 49A - Sleuth |
1541A - Pretty Permutations | 1632C - Strange Test |
673A - Bear and Game | 276A - Lunch Rush |